<?php include('includes/before_html.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />

        <meta name="description" content="" />

        <meta name="keywords" content="" />

        <meta name="author" content="" />

        <?php include('includes/head.php'); ?>

        <title><?php echo $heading ?></title>

    </head>

    <body>

        <div id="wrapper">

            <?php include('includes/header.php'); ?>

            <?php include('includes/nav.php'); ?>

            <div id="content">
                <h3>Custom Query</h3>
                <form name="form1" method="post" action="query_results.php">
                    <table width="100%" border="0" cellpadding="3" cellspacing="1">
                        <tr>
                            <td width="100%"><textarea id="query" name="query" rows="5" cols="70"></textarea></td>
                        </tr>
                        <tr>
                            <td><input type="submit" name="Submit" value="Submit Query"></input></td>
                        </tr>
                    </table>
                </form><br/>
                <?php
                $db = mysql_connect(db_server, $db_user, $db_password);
                if (!$db) {
                    //die('Could Not Connect: ' . mysql_error());
                } else {
                    //echo "Connected Successfully...\n";
                }

                mysql_select_db($db_dbname);

                echo "<strong>QUERY:&nbsp;&nbsp;&nbsp;&nbsp;</strong>" . $_POST['query'] . "<br>";
                if (isset($_POST['query']))
                    outputQueryResults(stripslashes($_POST['query']));


                mysql_close($db);
                ?>
            </div> <!-- end #content -->



            <?php include('includes/footer.php'); ?>

        </div> <!-- End #wrapper -->

    </body>

</html>